package com.hc.common.oss;

import lombok.Data;

import java.io.IOException;
import java.util.Properties;

/**
 * 阿里服务器配置
 *
 * @author 六月Bing
 */
@Data
public class AliOSSConfig {

    private static AliOSSConfig instance = new AliOSSConfig();
    private String endpoint;
    private String accessKeyId;
    private String accessKeySecret;
    private String bucketName;

    /**
     * 单例
     */
    private AliOSSConfig() {
        Properties properties = new Properties();
        try {
            properties.load(AliOSSConfig.class.getResourceAsStream("/oss/alioss.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        endpoint = properties.getProperty("endpoint");
        accessKeyId = properties.getProperty("accessKeyId");
        accessKeySecret = properties.getProperty("accessKeySecret");
        bucketName = properties.getProperty("bucketName");
    }

    public static AliOSSConfig getInstance() {
        return instance;
    }
}